flowchart LR
    U(User)
    subgraph Node
        FS1[(FileSystem)]
        P1[Pod]
        D1[Daemon]
        R1[eBpfRecorder]
        E1[LogEnricher]
        M1[Metrics]

        D1 -.->|install profile|FS1
        P1 -.-> |use profile|FS1
        D1 --> |gRPC: record profile| R1
        D1 --> |gRPC: record profile| E1
        D1 --> |gRPC: update metric| M1
        R1 --> |record profile| P1
        E1 --> |record profile| P1
        D1 -->|get/watch| P1
    end
    
    Recording[/ProfileRecording<br> CR/]
    Config[/SPOD CR/]
    Profile[/SeccompProfile CR<br>SelinuxProfile CR <br> ApparmorProfile CR/]
    Binding[ProfileBinding CR]
    W[Webhook]
    M[Manager]
    D[Daemonset]

    U -->|deploy|M
    U -->|deploy|W
    U -->|update|Config
    U -->|create|Recording
    U -->|create/update/get/delete|Profile

    W -.->|watch| Recording
    W -->|add annotations| P1

    M -.->|watch|Config
    M -->|create/update|D
    M -->|create<br>when not preset|W

    D -.->|start|D1
    D1 -.->|watch|Config
    D1-.->|get/update|Recording
    D1 -->|create/update/watch|Profile

    W-->|get|Binding
    W-->|get|Profile
    W-->|add SecurityContext<br>when profile binding is defined|P1

  classDef green fill:#9f6,stroke:#333,stroke-width:2px;
  classDef orange fill:#f96,stroke:#333,stroke-width:4px;
  classDef purple fill:#f9f,stroke:#333,stroke-width:4px
  class W,M,D,D1,D2,R1,R2,E1,M1 green
  class U orange
  class P1,P2 purple